Skip to content

chore: use JsonSchema proto#25

Merged
sohil-kshirsagar merged 3 commits into
mainfrom
sohil/use-json-schema-proto
Oct 14, 2025
Merged

chore: use JsonSchema proto#25
sohil-kshirsagar merged 3 commits into
mainfrom
sohil/use-json-schema-proto

Conversation

@sohil-kshirsagar

@sohil-kshirsagar sohil-kshirsagar commented Oct 10, 2025

Copy link
Copy Markdown
Contributor

Updates to use the new JsonSchema proto in SDK.

Corresponding PR in drift-schemas with release TODOs: Use-Tusk/tusk-drift-schemas#11

Other updates:

  • Keep test files in tsconfig.json so we get build errors in tests. This won't show up in our build because of tsdown.config.ts
  • Misc fixes due to getting build errors in tests

Note that empty properties map required for all schemas

Proto3 doesn't support optional maps, so every JsonSchema must have a properties field:

// Before
{ type: "STRING" }

// After
{ type: JsonSchemaType.STRING, properties: {} }

Impact: Slightly larger JSON payloads, but acceptable trade-off for type safety. I couldn't find a way around this.


Note

Switches SDK to proto-based JsonSchema types, passes schemas natively in protobuf, updates tests/HTTP utils accordingly, and enables test files in typecheck.

  • Core:
    • Replace local JsonSchemaType/EncodingType/DecodedType/JsonSchema with proto types from @use-tusk/drift-schemas/core/json_schema; re-export where needed.
    • Pass inputSchema/outputSchema as proto JsonSchema (no toStruct) in ProtobufCommunicator and ApiSpanAdapter.
    • Ensure all schemas include properties: {}; adjust array/Set handling.
    • Update CleanSpanData to use proto JsonSchema (make outputSchema optional).
  • HTTP Utils:
    • Remove HttpBodyType; getDecodedType now returns proto DecodedType.
    • Tests updated to treat bodies as base64 strings and decode before assertions.
  • Tests:
    • Widespread updates to expect enum numeric values and properties: {} in schemas.
    • Minor fixes (optional chaining, typings, method signatures).
  • Config/Deps:
    • Bump @use-tusk/drift-schemas to ^0.1.11.
    • tsconfig: include test files in typecheck (remove exclude patterns).

Written by Cursor Bugbot for commit 6bde6fd. This will update automatically on new commits. Configure here.

cursor[bot]

This comment was marked as outdated.

@sohil-kshirsagar sohil-kshirsagar marked this pull request as ready for review October 14, 2025 01:17
@sohil-kshirsagar sohil-kshirsagar merged commit 55746db into main Oct 14, 2025
3 checks passed
@sohil-kshirsagar sohil-kshirsagar deleted the sohil/use-json-schema-proto branch October 14, 2025 03:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants